package com.blogspot.radanddev.mbanksmsreader;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Paint.Style;
import android.util.AttributeSet;
import android.widget.AbsoluteLayout;

/**
 * @author: Radoslaw Czwojdrak (Rad and Dev)
 */

@SuppressWarnings("deprecation")
public class MojeOkienko extends AbsoluteLayout 
{ 
	private Paint ramka, okno, cien;
    
	public MojeOkienko(Context context, AttributeSet attrs) {
		super(context, attrs);
		init();
	}

	public MojeOkienko(Context context) {
		super(context);
		init();
	}
	

	private void init() {
		
		cien = new Paint();
		cien.setAntiAlias(true);
		cien.setShadowLayer(5f, 5f, 5f, R.drawable.czarny);
		cien.setAntiAlias(true);

		
		okno = new Paint();
		okno.setARGB(500, 75, 75, 75); //alpha - gray
		okno.setAntiAlias(true);

		
		ramka = new Paint();
		ramka.setARGB(255, 160, 192, 56);
		ramka.setAntiAlias(true);
		ramka.setStyle(Style.STROKE);
		ramka.setStrokeWidth(2);
	}



    @Override
    protected void dispatchDraw(Canvas canvas) {
        	
    	float lewy, gora, prawy, dol;
    	lewy = 2;
    	gora = 2;
    	prawy = canvas.getWidth() - 32;
    	dol = canvas.getHeight() - 160;

    	RectF oknoRect = new RectF();
    	oknoRect.set(lewy,gora,prawy,dol);
    	canvas.drawRoundRect(oknoRect, 5, 5, okno);


    	RectF ramkaRect = new RectF();
    	ramkaRect.set(lewy,gora,prawy,dol);
    	canvas.drawRoundRect(ramkaRect, 5, 5, ramka);
   	
		
    	super.dispatchDraw(canvas);		
    }
}